<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件绑定</title>
    <script src="/js/vue.js"></script>
</head>
<body>
<div id="app">
    <p>@事件名称   绑定相应的事件   v-on:等价于@</p>
    {{sum}}
    <p>{{sum>10?"大于10":"小于10"}}</p>
    <input type="button" value="增加" @click="increment(1)">
    <input type="button" value="减少" v-on:click="descement(1)">

</div>

<script>
    new Vue({
        el: "#app",
        data: {
            sum: 0
        },
        methods: {
            increment: function (num) {
                this.sum += num;
            },
            descement:function (num){
                this.sum-=num;
            }
        }
    });
</script>
</body>
</html>